home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Demos / AppMaker 2.0b3 / Demo AppMaker 1.5 / Demo AppMaker™ / Demo AppMaker™.rsrc / TmpP_110_Main < prev    next >
Encoding:
Text File  |  1992-04-08  |  1.4 KB  |  91 lines

  1. { %appName%.p -- Main }
  2. { Created %date% %time% by AppMaker }
  3.  
  4. Program %appName%;
  5. %if lang = Think%
  6.     {$I-}
  7. %end if%
  8.  
  9. Uses
  10.     %if lang = MPW%
  11.         Types,
  12.         Quickdraw,
  13.         Controls,
  14.         Dialogs,
  15.         Events,
  16.         Lists,
  17.         Menus,
  18.         SegLoad,
  19.         StandardFile,
  20.         TextEdit,
  21.  
  22.     %end if%
  23.     Globals,
  24.     ResourceDefs,
  25.     EventLoop,
  26.     FileM,
  27.     Miscellany;    
  28.  
  29. %if lang = MPW%
  30.     {$D+}
  31.     {$R+}
  32.     {$OV+}
  33.  
  34. %end if%
  35. var
  36.     finderMessage:    integer;
  37.     nrDocs:            integer;
  38.     
  39. {----------}
  40. Procedure PrintDocuments;
  41. Begin
  42.     Acknowledge (CantPrintID);
  43. End; {PrintDocuments}
  44.  
  45. {----------}
  46. Procedure OpenDocuments;
  47. var
  48.     N:                integer;
  49.     nrOpened:        integer;
  50.     docInfo:        AppFile;
  51. Begin
  52.     nrOpened := 0;
  53.     for N := 1 to nrDocs do begin
  54.         GetAppFiles (N, docInfo);
  55.         with docInfo do begin
  56.             if OkToOpen (fType) then begin
  57.                 OpenDoc (fName, vRefNum);
  58.                 nrOpened := nrOpened + 1;
  59.             end else begin
  60.                 ParamText (fName, '', '', '');
  61.                 Acknowledge (WrongTypeID);
  62.             end;
  63.         end; {with}
  64.         ClrAppFiles (N);
  65.     end; {for}
  66.     if nrOpened = 0 then begin
  67.         OpenApp;
  68.     end;
  69. End; {OpenDocuments}
  70.  
  71. {----------}
  72. Begin {%appName%}
  73.     Initialize;
  74.     CountAppFiles (finderMessage, nrDocs);
  75.     if nrDocs > 0 then begin
  76.         if finderMessage = AppPrint then begin
  77.             PrintDocuments;
  78.         end else begin
  79.             OpenDocuments;
  80.             MainLoop;
  81.         end;
  82.     end else begin
  83.         if sysConfig.hasAppleEvents then begin
  84.             {wait for OApp, ODoc, or PDoc AppleEvent}
  85.         end else begin
  86.             OpenApp;
  87.         end;
  88.         MainLoop;
  89.     end;
  90. End. {%appName%}
  91.